package com.jml;


import com.jml.feign.SmsServiceFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;


@RestController
@Slf4j
public class MemberServiceImpl{
    @Value("${server.port}")
    private String serverPort;

    @Autowired
    private SmsServiceFeign smsServiceFeign;

    @RequestMapping("/getUser")
    public String getUser(Integer userId) {
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        log.info("TraceId:"+request.getHeader("X-B3-TraceId")+",spanId:"+request.getHeader("X-B3-SpanId"));
        int j = 1/(userId-1);
        return smsServiceFeign.sendMsg(userId);
    }
}
